package com.omega_r.libs.omegarecyclerview.viewpager.default_transformers;

import ohos.agp.components.Component;

public class ForegroundToBackgroundTransformer extends ABaseTransformer {
    @Override
    protected void onTransform(Component component, float position) {
        float height = (float)component.getHeight();
        float width = (float)component.getWidth();
        float scale = min(position > (float)0 ? 1.0F : Math.abs(1.0F + position), 0.5F);
        component.setScaleX(scale);
        component.setScaleY(scale);
        component.setPivotX(width * 0.5F);
        component.setPivotY(height * 0.5F);
        component.setTranslationX(position > (float)0 ? width * position : -width * position * 0.25F);
    }
}
